<!DOCTYPE html>
<html>
<head>
<title>data scheme test</title>
</head>
<body>
<iframe src="data:text/html,&lt;script&gt;window.parent.postMessage(internals.getAgentId(window), '*');&lt;/script&gt;">
</iframe>
<script>
// This test loads an iframe whose src attribute is a data: URL. It posts
// it's agent ID to this frame, and we report the agent IDs of this frame and
// the child iframe.
//
// Success condition: The agent IDs of this frame and the child frame are
// different (the child frame should receive a unique agent because it's on
// an opaque origin).

function onMessage(evt) {
  let iframeAgentId = evt.data;
  let message = [
    'data scheme test',
    internals.getAgentId(window),
    iframeAgentId
  ];
  window.parent.postMessage(message, '*');
}

window.addEventListener('message', onMessage, {'once': true});
</script>
</body>
</html>
